/*
ID: lanxiaz1
LANG: JAVA
TASK: bigdance
*/
import java.io.*;
public class bigdance
{
	public static void main(String[] args)throws Exception
	{
		BufferedReader f = new BufferedReader(new FileReader("bigdance.in"));
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("bigdance.out")));
	   	int n=Integer.parseInt(f.readLine());
		long result=f(1,n);
		out.println(result);	
		out.flush();
		out.close();
	}
	static long f(int lo,int hi)
	{
		if(lo==hi)return 0;
		if(lo+1==hi) return lo*hi;
		int mid=(lo+hi)/2;
		return f(lo,mid)+f(mid+1,hi);
	}
}

